package com.cal.utms.action.payment;

import com.cal.utms.dto.payment.PaymentDto;
import com.cal.utms.model.payment.PaymentModel;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class PaymentAction extends ActionSupport implements ModelDriven<PaymentDto> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private PaymentDto paymentDto = new PaymentDto();
	private String paymentRequests;
	private int fundId;
	private int payment_id;
	PaymentModel model = new PaymentModel();

	public String cancelConfirmPayment() {
		model.cancelPayment(payment_id, paymentDto);
		return Action.SUCCESS;
	}

	public String paymentreject() {
		model.rejecet(payment_id, paymentDto);
		return Action.SUCCESS;
	}

	public String savePayments() {
		model.savePayments(paymentRequests, fundId, paymentDto);
		return Action.SUCCESS;
	}

	public String getAllPaymentRequest() {
		paymentDto.setPaymentDtos(model.getPaymets());
		return Action.SUCCESS;
	}

	public String getConfirmedPaymentRequest() {
		paymentDto.setPaymentDtos(model.getConfirmedPaymets());
		return Action.SUCCESS;
	}

	public String confirmPayment() {
		model.confirmPayment(payment_id, paymentDto);
		return Action.SUCCESS;
	}

	@Override
	public PaymentDto getModel() {
		return paymentDto;
	}

	public PaymentDto getPaymentDto() {
		return paymentDto;
	}

	public void setPaymentDto(PaymentDto paymentDto) {
		this.paymentDto = paymentDto;
	}

	public String getPaymentRequests() {
		return paymentRequests;
	}

	public void setPaymentRequests(String paymentRequests) {
		this.paymentRequests = paymentRequests;
	}

	public int getFundId() {
		return fundId;
	}

	public void setFundId(int fundId) {
		this.fundId = fundId;
	}

	public int getPayment_id() {
		return payment_id;
	}

	public void setPayment_id(int payment_id) {
		this.payment_id = payment_id;
	}

}
